using UnityEngine;

public class Skin : MonoBehaviour
{
	private SkinResizeListener[] _resizeListeners;

	private ParticleSystem[] _particles;

	public void SetSize(float ratio)
	{
		if (_resizeListeners == null)
		{
			_resizeListeners = GetComponentsInChildren<SkinResizeListener>();
		}
		SkinResizeListener[] resizeListeners = _resizeListeners;
		foreach (SkinResizeListener skinResizeListener in resizeListeners)
		{
			skinResizeListener.OnSizeChanged(ratio);
		}
	}

	public void PlayFX()
	{
		if (_particles == null)
		{
			_particles = GetComponentsInChildren<ParticleSystem>();
		}
		ParticleSystem[] particles = _particles;
		foreach (ParticleSystem particleSystem in particles)
		{
			particleSystem.Play();
		}
	}

	public void StopFX()
	{
		if (_particles == null)
		{
			_particles = GetComponentsInChildren<ParticleSystem>();
		}
		ParticleSystem[] particles = _particles;
		foreach (ParticleSystem particleSystem in particles)
		{
			particleSystem.Stop();
		}
	}
}
